package com.yao.serviceimpl;

import com.yao.dao.ServerDao;
import com.yao.entity.ServerEntity;
import com.yao.service.ServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class ServerServiceImpl implements ServerService {
    @Autowired
    private ServerDao serverDao;
    //    重写service接口的方法

    //    全局查找
    @Override
    public List<ServerEntity> findAll(String server) {
        return serverDao.findAll(server);
    }

    //    全局查找分页
    @Override
    public List<ServerEntity> findPage(String server,int page,int pageSize) {
        return serverDao.findPage(server,page,pageSize);
    }

    //    删除
    @Override
    public void delete(String server,int id) {
        serverDao.delete(server,id);
    }

    //    修改
    @Override
    public void update(String server,int id,String cabinet,String positions,String types,String stat,
                       String ip,String app,String systems,String apptype,String datas,
                       String numbers,String brand,String sn,String service,Date dates,String cpu,
                       String amount,String core,String ram,String disk,String capacity,String remain,
                       String used,String admin,String department,String remark) {
        serverDao.update(server,id,cabinet,positions,types,stat,ip,app,systems,
                        apptype,datas,numbers,brand,sn,service,dates,cpu,amount,
                        core,ram,disk,capacity,remain,used,admin,department, remark);
    }

    //    添加
    @Override
    public void add(String server,String cabinet,String positions,String types,String stat,
                    String ip,String app,String systems,String apptype,String datas,
                    String numbers,String brand,String sn,String service,Date dates,String cpu,
                    String amount,String core,String ram,String disk,String capacity,String remain,
                    String used,String admin,String department,String remark) {
        serverDao.add(server,cabinet,positions,types,stat,ip,app,systems,
                    apptype,datas,numbers,brand,sn,service,dates,cpu,amount,
                    core,ram,disk,capacity,remain,used,admin,department, remark);
    }

    //    模糊查找
    @Override
    public List<ServerEntity> findBySomething(
            String server,String cabinet,String types,String stat,String ip,String app,String systems,
            String apptype,String datas,String numbers,String brand,String sn,String service,Date startDate,Date endDate,
            String cpu,String amount,String core,String ram,String disk,String capacity,String remain,String used,String admin,String department) {
        return serverDao.findBySomething(
                server,cabinet,types,stat,ip,app,systems,
                apptype,datas,numbers,brand,sn,service,startDate,endDate,
                cpu,amount,core,ram,disk,capacity,remain,used,admin,department);
    }

    //    模糊查找分页
    @Override
    public List<ServerEntity> findByPage(
            String server,String cabinet,String types,String stat,String ip,String app,String systems,
            String apptype,String datas,String numbers,String brand,String sn,String service,Date startDate,Date endDate,
            String cpu,String amount,String core,String ram,String disk,String capacity,String remain,String used,String admin,String department,int page,int pageSize) {
        return serverDao.findByPage(
                server,cabinet,types,stat,ip,app,systems,
                apptype,datas,numbers,brand,sn,service,startDate,endDate,
                cpu,amount,core,ram,disk,capacity,remain,used,admin,department,page,pageSize);
    }

}
